import requests
import json

url_sug = "https://fanyi.baidu.com/sug"
headers = {
    'user-agent': 'Mozilla/5.0 (Windows NT 10.0; Win64; x64) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/87.0.4280.141 Safari/537.36',
    'referer': 'https://fanyi.baidu.com/'
}
while 1:
    data_translate = {"kw": input('请输入要翻译的中文')}
    response = requests.post(url=url_sug, headers=headers, data=data_translate)
    ret = json.loads(response.text)
    translate = ret['data'][0]['v']
    print(translate)